library AutoFly initializer onInit requires UnitDex
/***************************************************************
*
*   v1.0, by TriggerHappy
*   
*   AutoFly adds & removes crow of upon any unit entering the map. This
*   allows modifying of the units height without having to do it manually.
*
*   Credits go to azlier for the orginal idea.
*
****************************************************************/

    globals
        private constant integer CROW_FORM = 'Amrf'
    endglobals
    
    private function AddFly takes nothing returns boolean
        return UnitAddAbility(GetIndexedUnit(), CROW_FORM) and UnitRemoveAbility(GetIndexedUnit(), CROW_FORM)
    endfunction
    
    private function onInit takes nothing returns nothing
        call RegisterUnitIndexEvent(Filter(function AddFly), EVENT_UNIT_INDEX)
    endfunction

endlibrary